﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Web;
using System.Xml;
using System.Drawing.Printing;

namespace UTLBASEFORM
{
    public partial class MDICHILD : DevComponents.DotNetBar.Office2007Form
    {
        #region "Public Const"
        //const text lable for control
        public const string TextLabelExit = "&Thoát";
        public const string TextLabelHelp = "Trợ Giúp";
        public const string TextLabelSave = "&Lưu";
        public const string TextLabelReset = "Làm Lạ&i";
        public const string TextLabelCancel = "&Hủy";
        public const string TextLabelDelete = "&Xóa";
        public const string TextLabelEdit = "&Sửa";
        public const string TextLabelAdd = "T&hêm";
        public const string TextLableUpdate = "&Cập Nhật";
        public const string TextLableCheck = "&Kiểm kho";
        //const image name
        public const string ImageNameCheck_Ok = "Check_Ok";
        public const string ImageNameSave = "Save32x32";
        public const string ImageNameReset = "";
        public const string ImageNameEdit = "Edite24x24";
        public const string ImageNameEdit1 = "Edit32x32_1";
        public const string ImageNameDelete = "Delete24x24";
        public const string ImageNameUpdate = "";
        public const string ImageNameCancel = "Cancel24x24";
        public const string ImageNameHelp = "Help24x24";
        public const string ImageNameExit = "";
        public const string MsgTitile = "Tiệm Vàng Hồng Phúc";
        public const string MsgDataChange = "Dữ liệu đã thay đổi!";
        public const string MsgSaveChange = "Bạn có lưu lại không?";
        public const string ImageNameProcduct = "";
        public const string ImageNameMember = "";
        public const string ImageNameConfig = "Config24x24";
        public const string ImageNameSearch = "Search24x24";
        public const string ImageNameRefresh = "Refresh32x32";
        #endregion

        #region "Private variable"
        private CRate _Crate;
        private TextBox _NumberTextBox;
        private TextBox _NumberTextBoxWithseparator;
        private CUserLoginInfo _CuserLoginInfo;
        DataGridViewPrinter MyDataGridViewPrinter;
        private DataGridView GridPrint;
        #endregion

        public CUserLoginInfo UserLoginInfo
        {
            get { return _CuserLoginInfo; }
            set { _CuserLoginInfo = value; }
        }
        protected CRate CRATE
        {
            get { return _Crate; }
            set { _Crate = value; }
        }

        public MDICHILD(CUserLoginInfo userInfo)
        {

            InitializeComponent();
            btn1.Click += new EventHandler(btn1_Click);
            btn2.Click += new EventHandler(btn2_Click);
            btn3.Click += new EventHandler(btn3_Click);
            btn4.Click += new EventHandler(btn4_Click);
            btn5.Click += new EventHandler(btn5_Click);
            btn6.Click += new EventHandler(btn6_Click);
            btn7.Click += new EventHandler(btn7_Click);
            btn8.Click += new EventHandler(btn8_Click);
            btn9.Click += new EventHandler(btn9_Click);
            btn10.Click += new EventHandler(btn10_Click);
            btnESC.Click += new EventHandler(BTNESC_Click);
            btnF1.Click += new EventHandler(BTNF1_Click);
            btnF2.Click += new EventHandler(BTNF2_Click);
            btnF3.Click += new EventHandler(BTNF3_Click);
            btnF4.Click += new EventHandler(BTNF4_Click);
            btnF5.Click += new EventHandler(BTNF5_Click);
            btnF6.Click += new EventHandler(BTNF6_Click);
            btnF7.Click += new EventHandler(BTNF7_Click);
            btnF8.Click += new EventHandler(BTNF8_Click);
            btnF9.Click += new EventHandler(BTNF9_Click);
            btnF10.Click += new EventHandler(BTNF10_Click);
            btnF11.Click += new EventHandler(BTNF11_Click);
            btnF12.Click += new EventHandler(BTNF12_Click);

            UserLoginInfo = userInfo;

        }
        public MDICHILD()
        {
            InitializeComponent();
            btn1.Click += new EventHandler(btn1_Click);
            btn2.Click += new EventHandler(btn2_Click);
            btn3.Click += new EventHandler(btn3_Click);
            btn4.Click += new EventHandler(btn4_Click);
            btn5.Click += new EventHandler(btn5_Click);
            btn6.Click += new EventHandler(btn6_Click);
            btn7.Click += new EventHandler(btn7_Click);
            btn8.Click += new EventHandler(btn8_Click);
            btn9.Click += new EventHandler(btn9_Click);
            btn10.Click += new EventHandler(btn10_Click);
            btnESC.Click += new EventHandler(BTNESC_Click);
            btnF1.Click += new EventHandler(BTNF1_Click);
            btnF2.Click += new EventHandler(BTNF2_Click);
            btnF3.Click += new EventHandler(BTNF3_Click);
            btnF4.Click += new EventHandler(BTNF4_Click);
            btnF5.Click += new EventHandler(BTNF5_Click);
            btnF6.Click += new EventHandler(BTNF6_Click);
            btnF7.Click += new EventHandler(BTNF7_Click);
            btnF8.Click += new EventHandler(BTNF8_Click);
            btnF9.Click += new EventHandler(BTNF9_Click);
            btnF10.Click += new EventHandler(BTNF10_Click);
            btnF11.Click += new EventHandler(BTNF11_Click);
            btnF12.Click += new EventHandler(BTNF12_Click);

        }

        #region BTN1 Define
        /// <summary>
        /// BTN 2 Click.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param> 
        public virtual void btn1_Click(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// BTN 1 Show.
        /// </summary>
        /// <param name="textlabel">Lable to show to screen of the button</param>
        ///<param name="imgname">Image name to show</param>
        public void ShowBTN1(string textlabel, string imgname)
        {
            this.btn1.Visible = true;
            this.btn1.Text = textlabel;
            //Bitmap temp = new Bitmap(Image.FromHbitmap(global::UTLBASEFORM.Properties.Resources.Check_Ok.GetHbitmap()));

            //temp.MakeTransparent(temp.GetPixel(0, 0));
            this.btn1.Image = getImage(imgname);//(Image)temp;
            this.btn1.Tooltip = textlabel.Replace("&", "");
            //this.btn1.Tooltip = textlabel.Replace("&","");

        }
        /// <summary>
        /// BTN 1 Hide.
        /// </summary>
        public void HideBTN1()
        {
            this.btn1.Visible = false;
        }
        /// <summary>
        /// BTN 1 Enable.
        /// </summary>
        public void EnableBTN1()
        {
            this.btn1.Enabled = true;
        }
        /// <summary>
        /// BTN 1 Disable.
        /// </summary>
        public void DisableBTN1()
        {
            this.btn1.Enabled = false;
        }
        #endregion
        #region BTN2 Define
        /// <summary>
        /// BTN 2 Click.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>        
        public virtual void btn2_Click(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// BTN 2 Show.
        /// </summary>
        /// <param name="textlabel">Lable to show to screen of the button</param>
        ///<param name="imgname">Image name to show</param>
        public void ShowBTN2(string textlabel, string imgname)
        {
            this.btn2.Visible = true;
            this.btn2.Text = textlabel;
            this.btn2.Image = getImage(imgname);
            this.btn2.Tooltip = textlabel.Replace("&", "");
        }
        /// <summary>
        /// BTN 2 Hide.
        /// </summary>        
        public void HideBTN2()
        {
            this.btn2.Visible = false;
        }
        /// <summary>
        /// BTN 2 Enable.
        /// </summary>
        public void EnableBTN2()
        {
            this.btn2.Enabled = true;
        }
        /// <summary>
        /// BTN 2 Disable.
        /// </summary>
        public void DisableBTN2()
        {
            this.btn2.Enabled = false;
        }
        #endregion
        #region BTN3 Define
        /// <summary>
        /// BTN 3 Click.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>        
        public virtual void btn3_Click(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// BTN 3 Show.
        /// </summary>
        /// <param name="textlabel">Lable to show to screen of the button</param>
        ///<param name="imgname">Image name to show</param>
        public void ShowBTN3(string textlabel, string imgname)
        {
            this.btn3.Visible = true;
            this.btn3.Text = textlabel;
            this.btn3.Image = getImage(imgname);
            this.btn3.Tooltip = textlabel.Replace("&", "");
        }
        /// <summary>
        /// BTN 3 Hide.
        /// </summary>        
        public void HideBTN3()
        {
            this.btn3.Visible = false;
        }
        /// <summary>
        /// BTN 3 Enable.
        /// </summary>
        public void EnableBTN3()
        {
            this.btn3.Enabled = true;
        }
        /// <summary>
        /// BTN 3 Disable.
        /// </summary>
        public void DisableBTN3()
        {
            this.btn3.Enabled = false;
        }
        #endregion
        #region BTN4 Define
        /// <summary>
        /// BTN 4 Click.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>        
        public virtual void btn4_Click(object sender, EventArgs e)
        {
            if (SetupThePrinting())
            {
                PrintPreviewDialog MyPrintPreviewDialog = new PrintPreviewDialog();
                MyPrintPreviewDialog.Document = printDocument1;
                MyPrintPreviewDialog.ShowDialog();
            }
        }
        /// <summary>
        /// BTN 4 Show.
        /// </summary>
        /// <param name="textlabel">Lable to show to screen of the button</param>
        ///<param name="imgname">Image name to show</param>
        public void ShowBTN4(string textlabel, string imgname)
        {
            this.btn4.Visible = true;
            this.btn4.Text = textlabel;
            this.btn4.Image = getImage(imgname);
            this.btn4.Tooltip = textlabel.Replace("&", "");
        }
        /// <summary>
        /// BTN 4 Hide.
        /// </summary>        
        public void HideBTN4()
        {
            this.btn4.Visible = false;
        }
        /// <summary>
        /// BTN 4 Enable.
        /// </summary>
        public void EnableBTN4()
        {
            this.btn4.Enabled = true;
        }
        /// <summary>
        /// BTN 4 Disable.
        /// </summary>
        public void DisableBTN4()
        {
            this.btn4.Enabled = false;
        }
        #endregion
        #region BTN5 Define
        /// <summary>
        /// BTN 5 Click.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>        
        public virtual void btn5_Click(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// BTN 5 Show.
        /// </summary>
        /// <param name="textlabel">Lable to show to screen of the button</param>
        ///<param name="imgname">Image name to show</param>
        public void ShowBTN5(string textlabel, string imgname)
        {
            this.btn5.Visible = true;
            this.btn5.Text = textlabel;
            this.btn5.Image = getImage(imgname);
            this.btn5.Tooltip = textlabel.Replace("&", "");
        }
        /// <summary>
        /// BTN 5 Hide.
        /// </summary>        
        public void HideBTN5()
        {
            this.btn5.Visible = false;
        }
        /// <summary>
        /// BTN 5 Enable.
        /// </summary>
        public void EnableBTN5()
        {
            this.btn5.Enabled = true;
        }
        /// <summary>
        /// BTN 5 Disable.
        /// </summary>
        public void DisableBTN5()
        {
            this.btn5.Enabled = false;
        }
        #endregion
        #region BTN6 Define
        /// <summary>
        /// BTN 6 Click.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>        
        public virtual void btn6_Click(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// BTN 6 Show.
        /// </summary>
        /// <param name="textlabel">Lable to show to screen of the button</param>
        ///<param name="imgname">Image name to show</param>
        public void ShowBTN6(string textlabel, string imgname)
        {
            this.btn6.Visible = true;
            this.btn6.Text = textlabel;
            this.btn6.Image = getImage(imgname);
            this.btn6.Tooltip = textlabel.Replace("&", "");
        }
        /// <summary>
        /// BTN 6 Hide.
        /// </summary>        
        public void HideBTN6()
        {
            this.btn6.Visible = false;
        }
        /// <summary>
        /// BTN 6 Enable.
        /// </summary>
        public void EnableBTN6()
        {
            this.btn6.Enabled = true;
        }
        /// <summary>
        /// BTN 6 Disable.
        /// </summary>
        public void DisableBTN6()
        {
            this.btn6.Enabled = false;
        }
        #endregion
        #region BTN7 Define
        /// <summary>
        /// BTN 7 Click.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>        
        public virtual void btn7_Click(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// BTN 7 Show.
        /// </summary>
        /// <param name="textlabel">Lable to show to screen of the button</param>
        ///<param name="imgname">Image name to show</param>
        public void ShowBTN7(string textlabel, string imgname)
        {
            this.btn7.Visible = true;
            this.btn7.Text = textlabel;
            this.btn7.Image = getImage(imgname);
            this.btn7.Tooltip = textlabel.Replace("&", "");
        }
        /// <summary>
        /// BTN 7 Hide.
        /// </summary>        
        public void HideBTN7()
        {
            this.btn7.Visible = false;
        }
        /// <summary>
        /// BTN 7 Enable.
        /// </summary>
        public void EnableBTN7()
        {
            this.btn7.Enabled = true;
        }
        /// <summary>
        /// BTN 7 Disable.
        /// </summary>
        public void DisableBTN7()
        {
            this.btn7.Enabled = false;
        }
        #endregion
        #region BTN8 Define
        /// <summary>
        /// BTN 8 Click.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>        
        public virtual void btn8_Click(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// BTN 8 Show.
        /// </summary>
        /// <param name="textlabel">Lable to show to screen of the button</param>
        ///<param name="imgname">Image name to show</param>
        public void ShowBTN8(string textlabel, string imgname)
        {
            this.btn8.Visible = true;
            this.btn8.Text = textlabel;
            this.btn8.Image = getImage(imgname);
            this.btn8.Tooltip = textlabel.Replace("&", "");
        }
        /// <summary>
        /// BTN 8 Hide.
        /// </summary>        
        public void HideBTN8()
        {
            this.btn8.Visible = false;
        }
        /// <summary>
        /// BTN 8 Enable.
        /// </summary>
        public void EnableBTN8()
        {
            this.btn8.Enabled = true;
        }
        /// <summary>
        /// BTN 8 Disable.
        /// </summary>
        public void DisableBTN8()
        {
            this.btn8.Enabled = false;
        }
        #endregion
        #region BTN9 Define
        /// <summary>
        /// BTN 9 Click.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>        
        public virtual void btn9_Click(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// BTN 9 Show.
        /// </summary>
        /// <param name="textlabel">Lable to show to screen of the button</param>
        ///<param name="imgname">Image name to show</param>
        public void ShowBTN9(string textlabel, string imgname)
        {
            this.btn9.Visible = true;
            this.btn9.Text = textlabel;
            this.btn9.Image = getImage(imgname);
            this.btn9.Tooltip = textlabel.Replace("&", "");
        }
        /// <summary>
        /// BTN 9 Hide.
        /// </summary>        
        public void HideBTN9()
        {
            this.btn9.Visible = false;
        }
        /// <summary>
        /// BTN 9 Enable.
        /// </summary>
        public void EnableBTN9()
        {
            this.btn9.Enabled = true;
        }
        /// <summary>
        /// BTN 9 Disable.
        /// </summary>
        public void DisableBTN9()
        {
            this.btn9.Enabled = false;
        }
        #endregion
        #region BTN10 Define
        /// <summary>
        /// BTN 10 Click.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>        
        public virtual void btn10_Click(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// BTN 10 Show.
        /// </summary>
        /// <param name="textlabel">Lable to show to screen of the button</param>
        ///<param name="imgname">Image name to show</param>
        public void ShowBTN10(string textlabel, string imgname)
        {
            this.btn10.Visible = true;
            this.btn10.Text = textlabel;
            this.btn10.Image = getImage(imgname);
            this.btn10.Tooltip = textlabel.Replace("&", "");
        }
        /// <summary>
        /// BTN 10 Hide.
        /// </summary>        
        public void HideBTN10()
        {
            this.btn10.Visible = false;
        }
        /// <summary>
        /// BTN 10 Enable.
        /// </summary>
        public void EnableBTN10()
        {
            this.btn10.Enabled = true;
        }
        /// <summary>
        /// BTN 10 Disable.
        /// </summary>
        public void DisableBTN10()
        {
            this.btn10.Enabled = false;
        }
        #endregion

        public static Image getImage(string imgname)
        {
            switch (imgname)
            {
                    
                case ImageNameCheck_Ok:
                    return global::UTLBASEFORM.Properties.Resources.Save24x24;
                case ImageNameHelp:
                    return global::UTLBASEFORM.Properties.Resources.Help;
                case ImageNameCancel:
                    return global::UTLBASEFORM.Properties.Resources.Cancel24x24;
                case ImageNameEdit1:
                    return global::UTLBASEFORM.Properties.Resources.Edite24x24;
                case ImageNameEdit:
                    return global::UTLBASEFORM.Properties.Resources.Edite24x24;
                case ImageNameSave:
                    return global::UTLBASEFORM.Properties.Resources.Save24x24;
                case ImageNameDelete:
                    return global::UTLBASEFORM.Properties.Resources.Delete24x24;
                case ImageNameConfig:
                    return global::UTLBASEFORM.Properties.Resources.Config24x24;
                case ImageNameSearch:
                    return global::UTLBASEFORM.Properties.Resources.Search24x24;
                case ImageNameRefresh:
                    return global::UTLBASEFORM.Properties.Resources.Refresh32x32;
                default:
                    return null;
            }

        }

        #region BTNESC Define
        /// <summary>
        /// BTNESC Click.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param> 
        public virtual void BTNESC_Click(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// BTNESC Show.
        /// </summary>
        /// <param name="textlabel">Lable to show to screen of the button</param>
        ///<param name="imgname">Image name to show</param>
        public void ShowBTNESC(string textlabel, string imgname)
        {
            this.btnESC.Visible = true;
            this.btnESC.Text = textlabel;
            this.btnESC.Image = getImage(imgname);
            this.btnESC.Tooltip = textlabel.Replace("&", "");
        }
        /// <summary>
        /// BTNESC Hide.
        /// </summary>
        public void HideBTNESC()
        {
            this.btnESC.Visible = false;
        }
        /// <summary>
        /// BTNESC Enable.
        /// </summary>
        public void EnableBTNESC()
        {
            this.btnESC.Enabled = true;
        }
        /// <summary>
        /// BTNESC Disable.
        /// </summary>
        public void DisableBTNESC()
        {
            this.btnESC.Enabled = false;
        }
        #endregion
        #region BTNF1 Define
        /// <summary>
        /// BTNF1 Click.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param> 
        public virtual void BTNF1_Click(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// BTNF1 Show.
        /// </summary>
        /// <param name="textlabel">Lable to show to screen of the button</param>
        ///<param name="imgname">Image name to show</param>
        public void ShowBTNF1(string textlabel, string imgname)
        {
            this.btnF1.Visible = true;
            this.btnF1.Text = textlabel;
            this.btnF1.Image = getImage(imgname);
            this.btnF1.Tooltip = textlabel.Replace("&", "");
        }
        /// <summary>
        /// BTNF1 Hide.
        /// </summary>
        public void HideBTNF1()
        {
            this.btnF1.Visible = false;
        }
        /// <summary>
        /// BTNF1 Enable.
        /// </summary>
        public void EnableBTNF1()
        {
            this.btnF1.Enabled = true;
        }
        /// <summary>
        /// BTNF1 Disable.
        /// </summary>
        public void DisableBTNF1()
        {
            this.btnF1.Enabled = false;
        }
        #endregion
        #region BTNF2 Define
        /// <summary>
        /// BTNF2 Click.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param> 
        public virtual void BTNF2_Click(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// BTNF2 Show.
        /// </summary>
        /// <param name="textlabel">Lable to show to screen of the button</param>
        ///<param name="imgname">Image name to show</param>
        public void ShowBTNF2(string textlabel, string imgname)
        {
            this.btnF2.Visible = true;
            this.btnF2.Text = textlabel;
            this.btnF2.Image = getImage(imgname);
            this.btnF2.Tooltip = textlabel.Replace("&", "");
        }
        /// <summary>
        /// BTNF2 Hide.
        /// </summary>
        public void HideBTNF2()
        {
            this.btnF2.Visible = false;
        }
        /// <summary>
        /// BTNF2 Enable.
        /// </summary>
        public void EnableBTNF2()
        {
            this.btnF2.Enabled = true;
        }
        /// <summary>
        /// BTNF2 Disable.
        /// </summary>
        public void DisableBTNF2()
        {
            this.btnF2.Enabled = false;
        }
        #endregion
        #region BTNF3 Define
        /// <summary>
        /// BTNF3 Click.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param> 
        public virtual void BTNF3_Click(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// BTNF3 Show.
        /// </summary>
        /// <param name="textlabel">Lable to show to screen of the button</param>
        ///<param name="imgname">Image name to show</param>
        public void ShowBTNF3(string textlabel, string imgname)
        {
            this.btnF3.Visible = true;
            this.btnF3.Text = textlabel;
            this.btnF3.Image = getImage(imgname);
            this.btnF3.Tooltip = textlabel.Replace("&", "");
        }
        /// <summary>
        /// BTNF3 Hide.
        /// </summary>
        public void HideBTNF3()
        {
            this.btnF3.Visible = false;
        }
        /// <summary>
        /// BTNF3 Enable.
        /// </summary>
        public void EnableBTNF3()
        {
            this.btnF3.Enabled = true;
        }
        /// <summary>
        /// BTNF3 Disable.
        /// </summary>
        public void DisableBTNF3()
        {
            this.btnF3.Enabled = false;
        }
        #endregion
        #region BTNF4 Define
        /// <summary>
        /// BTNF4 Click.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param> 
        public virtual void BTNF4_Click(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// BTNF4 Show.
        /// </summary>
        /// <param name="textlabel">Lable to show to screen of the button</param>
        ///<param name="imgname">Image name to show</param>
        public void ShowBTNF4(string textlabel, string imgname)
        {
            this.btnF4.Visible = true;
            this.btnF4.Text = textlabel;
            this.btnF4.Image = getImage(imgname);
            this.btnF4.Tooltip = textlabel.Replace("&", "");
        }
        /// <summary>
        /// BTNF4 Hide.
        /// </summary>
        public void HideBTNF4()
        {
            this.btnF4.Visible = false;
        }
        /// <summary>
        /// BTNF4 Enable.
        /// </summary>
        public void EnableBTNF4()
        {
            this.btnF4.Enabled = true;
        }
        /// <summary>
        /// BTNF4 Disable.
        /// </summary>
        public void DisableBTNF4()
        {
            this.btnF4.Enabled = false;
        }
        #endregion
        #region BTNF5 Define
        /// <summary>
        /// BTNF5 Click.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param> 
        public virtual void BTNF5_Click(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// BTNF5 Show.
        /// </summary>
        /// <param name="textlabel">Lable to show to screen of the button</param>
        ///<param name="imgname">Image name to show</param>
        public void ShowBTNF5(string textlabel, string imgname)
        {
            this.btnF5.Visible = true;
            this.btnF5.Text = textlabel;
            this.btnF5.Image = getImage(imgname);
            this.btnF5.Tooltip = textlabel.Replace("&", "");
        }
        /// <summary>
        /// BTNF5 Hide.
        /// </summary>
        public void HideBTNF5()
        {
            this.btnF5.Visible = false;
        }
        /// <summary>
        /// BTNF5 Enable.
        /// </summary>
        public void EnableBTNF5()
        {
            this.btnF5.Enabled = true;
        }
        /// <summary>
        /// BTNF5 Disable.
        /// </summary>
        public void DisableBTNF5()
        {
            this.btnF5.Enabled = false;
        }
        #endregion
        #region BTNF6 Define
        /// <summary>
        /// BTNF6 Click.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param> 
        public virtual void BTNF6_Click(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// BTNF6 Show.
        /// </summary>
        /// <param name="textlabel">Lable to show to screen of the button</param>
        ///<param name="imgname">Image name to show</param>
        public void ShowBTNF6(string textlabel, string imgname)
        {
            this.btnF6.Visible = true;
            this.btnF6.Text = textlabel;
            this.btnF6.Image = getImage(imgname);
            this.btnF6.Tooltip = textlabel.Replace("&", "");
        }
        /// <summary>
        /// BTNF6 Hide.
        /// </summary>
        public void HideBTNF6()
        {
            this.btnF6.Visible = false;
        }
        /// <summary>
        /// BTNF6 Enable.
        /// </summary>
        public void EnableBTNF6()
        {
            this.btnF6.Enabled = true;
        }
        /// <summary>
        /// BTNF6 Disable.
        /// </summary>
        public void DisableBTNF6()
        {
            this.btnF6.Enabled = false;
        }
        #endregion
        #region BTNF7 Define
        /// <summary>
        /// BTNF7 Click.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param> 
        public virtual void BTNF7_Click(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// BTNF7 Show.
        /// </summary>
        /// <param name="textlabel">Lable to show to screen of the button</param>
        ///<param name="imgname">Image name to show</param>
        public void ShowBTNF7(string textlabel, string imgname)
        {
            this.btnF7.Visible = true;
            this.btnF7.Text = textlabel;
            this.btnF7.Image = getImage(imgname);
            this.btnF7.Tooltip = textlabel.Replace("&", "");
        }
        /// <summary>
        /// BTNF7 Hide.
        /// </summary>
        public void HideBTNF7()
        {
            this.btnF7.Visible = false;
        }
        /// <summary>
        /// BTNF7 Enable.
        /// </summary>
        public void EnableBTNF7()
        {
            this.btnF7.Enabled = true;
        }
        /// <summary>
        /// BTNF7 Disable.
        /// </summary>
        public void DisableBTNF7()
        {
            this.btnF7.Enabled = false;
        }
        #endregion
        #region BTNF8 Define
        /// <summary>
        /// BTNF8 Click.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param> 
        public virtual void BTNF8_Click(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// BTNF8 Show.
        /// </summary>
        /// <param name="textlabel">Lable to show to screen of the button</param>
        ///<param name="imgname">Image name to show</param>
        public void ShowBTNF8(string textlabel, string imgname)
        {
            this.btnF8.Visible = true;
            this.btnF8.Text = textlabel;
            this.btnF8.Image = getImage(imgname);
            this.btnF8.Tooltip = textlabel.Replace("&", "");
        }
        /// <summary>
        /// BTNF8 Hide.
        /// </summary>
        public void HideBTNF8()
        {
            this.btnF8.Visible = false;
        }
        /// <summary>
        /// BTNF8 Enable.
        /// </summary>
        public void EnableBTNF8()
        {
            this.btnF8.Enabled = true;
        }
        /// <summary>
        /// BTNF8 Disable.
        /// </summary>
        public void DisableBTNF8()
        {
            this.btnF8.Enabled = false;
        }
        #endregion
        #region BTNF9 Define
        /// <summary>
        /// BTNF9 Click.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param> 
        public virtual void BTNF9_Click(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// BTNF9 Show.
        /// </summary>
        /// <param name="textlabel">Lable to show to screen of the button</param>
        ///<param name="imgname">Image name to show</param>
        public void ShowBTNF9(string textlabel, string imgname)
        {
            this.btnF9.Visible = true;
            this.btnF9.Text = textlabel;
            this.btnF9.Image = getImage(imgname);
            this.btnF9.Tooltip = textlabel.Replace("&", "");
        }
        /// <summary>
        /// BTNF9 Hide.
        /// </summary>
        public void HideBTNF9()
        {
            this.btnF9.Visible = false;
        }
        /// <summary>
        /// BTNF9 Enable.
        /// </summary>
        public void EnableBTNF9()
        {
            this.btnF9.Enabled = true;
        }
        /// <summary>
        /// BTNF9 Disable.
        /// </summary>
        public void DisableBTNF9()
        {
            this.btnF9.Enabled = false;
        }
        #endregion
        #region BTNF10 Define
        /// <summary>
        /// BTNF10 Click.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param> 
        public virtual void BTNF10_Click(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// BTNF10 Show.
        /// </summary>
        /// <param name="textlabel">Lable to show to screen of the button</param>
        ///<param name="imgname">Image name to show</param>
        public void ShowBTNF10(string textlabel, string imgname)
        {
            this.btnF10.Visible = true;
            this.btnF10.Text = textlabel;
            this.btnF10.Image = getImage(imgname);
            this.btnF10.Tooltip = textlabel.Replace("&", "");
        }
        /// <summary>
        /// BTNF10 Hide.
        /// </summary>
        public void HideBTNF10()
        {
            this.btnF10.Visible = false;
        }
        /// <summary>
        /// BTNF10 Enable.
        /// </summary>
        public void EnableBTNF10()
        {
            this.btnF10.Enabled = true;
        }
        /// <summary>
        /// BTNF10 Disable.
        /// </summary>
        public void DisableBTNF10()
        {
            this.btnF10.Enabled = false;
        }
        #endregion
        #region BTNF11 Define
        /// <summary>
        /// BTNF11 Click.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param> 
        public virtual void BTNF11_Click(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// BTNF11 Show.
        /// </summary>
        /// <param name="textlabel">Lable to show to screen of the button</param>
        ///<param name="imgname">Image name to show</param>
        public void ShowBTNF11(string textlabel, string imgname)
        {
            this.btnF11.Visible = true;
            this.btnF11.Text = textlabel;
            this.btnF11.Image = getImage(imgname);
            this.btnF11.Tooltip = textlabel.Replace("&", "");
        }
        /// <summary>
        /// BTNF11 Hide.
        /// </summary>
        public void HideBTNF11()
        {
            this.btnF11.Visible = false;
        }
        /// <summary>
        /// BTNF11 Enable.
        /// </summary>
        public void EnableBTNF11()
        {
            this.btnF11.Enabled = true;
        }
        /// <summary>
        /// BTNF11 Disable.
        /// </summary>
        public void DisableBTNF11()
        {
            this.btnF11.Enabled = false;
        }
        #endregion
        #region BTNF12 Define
        /// <summary>
        /// BTNF12 Click.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param> 
        public virtual void BTNF12_Click(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// BTNF12 Show.
        /// </summary>
        /// <param name="textlabel">Lable to show to screen of the button</param>
        ///<param name="imgname">Image name to show</param>
        public void ShowBTNF12(string textlabel, string imgname)
        {
            this.btnF12.Visible = true;
            this.btnF12.Text = textlabel;
            this.btnF12.Image = getImage(imgname);
            this.btnF12.Tooltip = textlabel.Replace("&", "");
        }
        /// <summary>
        /// BTNF12 Hide.
        /// </summary>
        public void HideBTNF12()
        {
            this.btnF12.Visible = false;
        }
        /// <summary>
        /// BTNF12 Enable.
        /// </summary>
        public void EnableBTNF12()
        {
            this.btnF12.Enabled = true;
        }
        /// <summary>
        /// BTNF12 Disable.
        /// </summary>
        public void DisableBTNF12()
        {
            this.btnF12.Enabled = false;
        }
        #endregion

        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            switch (keyData)
            {
                case Keys.Escape:
                    BTNESC_Click(null, null);
                    break;
                case Keys.F1:
                    BTNF1_Click(null, null);
                    break;
                case Keys.F2:
                    BTNF2_Click(null, null);
                    break;
                case Keys.F3:
                    BTNF3_Click(null, null);
                    break;
                case Keys.F4:
                    BTNF4_Click(null, null);
                    break;
                case Keys.F5:
                    BTNF5_Click(null, null);
                    break;
                case Keys.F6:
                    BTNF6_Click(null, null);
                    break;
                case Keys.F7:
                    BTNF7_Click(null, null);
                    break;
                case Keys.F8:
                    BTNF8_Click(null, null);
                    break;
                case Keys.F9:
                    BTNF9_Click(null, null);
                    break;
                case Keys.F10:
                    BTNF10_Click(null, null);
                    break;
                case Keys.F11:
                    BTNF11_Click(null, null);
                    break;
                case Keys.F12:
                    BTNF12_Click(null, null);
                    break;
                default:
                    break;
            }
            return base.ProcessCmdKey(ref msg, keyData);
        }

        #region FORM
        public void ShowMenuBar()
        {
            this.ToolBarChild.Visible = true;
        }
        public void HideMenuBar()
        {
            this.ToolBarChild.Visible = false;
        }
        private void MDICHILD_FormClosed(object sender, FormClosedEventArgs e)
        {

        }
        private void MDICHILD_Load(object sender, EventArgs e)
        {

        }
        private void MDICHILD_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (HasChange())
            {
                switch (MessageBox.Show(MsgDataChange + "\n" + MsgSaveChange, MsgTitile, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign))
                {
                    case DialogResult.Yes:
                        SaveChange();
                        break;
                    case DialogResult.No:
                        this.Close();
                        break;
                    case DialogResult.Cancel:
                        e.Cancel = true;
                        break;
                }

            }
        }
        #endregion

        protected virtual void SaveChange()
        {
        }
        protected virtual bool HasChange()
        {
            return false;
        }

        public TextBox NumberTextBox
        {
            set
            {
                _NumberTextBox = value;
                EventKeyPress();
            }
            get { return _NumberTextBox; }
        }
        protected void EventKeyPress()
        {
            _NumberTextBox.KeyPress += new KeyPressEventHandler(_NumberTextBox_KeyPress);
        }
        void _NumberTextBox_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!Char.IsDigit(e.KeyChar) && !Char.IsControl(e.KeyChar))
                e.Handled = true;
        }
        public TextBox NumerTextBoxWithSeparator
        {
            set
            {
                _NumberTextBoxWithseparator = value;
                EventKeyPressWithSeparator();
            }
            get { return _NumberTextBoxWithseparator; }
        }
        private void EventKeyPressWithSeparator()
        {
            _NumberTextBoxWithseparator.KeyPress += new KeyPressEventHandler(_NumberTextBoxWithseparator_KeyPress);
        }
        void _NumberTextBoxWithseparator_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!Char.IsDigit(e.KeyChar) && !Char.IsControl(e.KeyChar) && !e.KeyChar.ToString().Equals(",") && !e.KeyChar.ToString().Equals("."))
                e.Handled = true;
        }

        public DataGridView GirdviewPrinting
        {
            set
            {
                GridPrint = value;
                printDocument1.PrintPage += new PrintPageEventHandler(printDocument1_PrintPage);
            }
            get
            {
                return GridPrint;
            }
        }
        void printDocument1_PrintPage(object sender, PrintPageEventArgs e)
        {
            bool more = MyDataGridViewPrinter.DrawDataGridView(e.Graphics);
            if (more == true)
                e.HasMorePages = true;
        }
        protected bool SetupThePrinting()
        {
            PrintDialog MyPrintDialog = new PrintDialog();
            try
            {
                MyPrintDialog.AllowCurrentPage = CPaser.getBool(CConfigurationManager.ReadConfig("AllowCurrentPage"));
            }
            catch
            {
                MyPrintDialog.AllowCurrentPage = false;
            }
            try
            {
                MyPrintDialog.AllowPrintToFile = CPaser.getBool(CConfigurationManager.ReadConfig("AllowPrintToFile"));
            }
            catch
            {
                MyPrintDialog.AllowPrintToFile = false;
            }
            try
            {
                MyPrintDialog.AllowSelection = CPaser.getBool(CConfigurationManager.ReadConfig("AllowSelection"));
            }
            catch
            {
                MyPrintDialog.AllowSelection = false;
            }
            try
            {
                MyPrintDialog.AllowSomePages = CPaser.getBool(CConfigurationManager.ReadConfig("AllowSomePagesAllowSomePages"));
            }
            catch
            {
                MyPrintDialog.AllowSomePages = false;
            }
            try
            {
                MyPrintDialog.PrintToFile = CPaser.getBool(CConfigurationManager.ReadConfig("PrintToFile"));
            }
            catch
            {
                MyPrintDialog.PrintToFile = false;
            }
            try
            {
                MyPrintDialog.ShowHelp = CPaser.getBool(CConfigurationManager.ReadConfig("ShowHelp"));
            }
            catch
            {
                MyPrintDialog.ShowHelp = false;
            }
            try
            {
                MyPrintDialog.ShowNetwork = CPaser.getBool(CConfigurationManager.ReadConfig("ShowNetwork"));
            }
            catch
            {
                MyPrintDialog.ShowNetwork = false;
            }
            if (MyPrintDialog.ShowDialog() != DialogResult.OK)
                return false;
            try
            {
                printDocument1.DocumentName = CConfigurationManager.ReadConfig("DocumentName");
            }
            catch
            {
                printDocument1.DocumentName = "Báo Cáo";
            }
            printDocument1.PrinterSettings = MyPrintDialog.PrinterSettings;
            printDocument1.DefaultPageSettings = MyPrintDialog.PrinterSettings.DefaultPageSettings;
            int _left = 40;
            int _right = 40;
            int _top = 40;
            int _bottom = 40;
            try
            {
                _left = CPaser.getInt(CConfigurationManager.ReadConfig("DefaultPageSettings.Margins.Top"));
            }
            catch
            {
            }
            try
            {
                _right = CPaser.getInt(CConfigurationManager.ReadConfig("DefaultPageSettings.Margins.Left"));
            }
            catch
            { }
            try
            {
                _top = CPaser.getInt(CConfigurationManager.ReadConfig("DefaultPageSettings.Margins.Right"));
            }
            catch
            {
            }
            try
            {
                _bottom = CPaser.getInt(CConfigurationManager.ReadConfig("DefaultPageSettings.Margins.Bottom"));
            }
            catch
            { }
            printDocument1.DefaultPageSettings.Margins = new Margins(_left, _right, _top, _bottom);

            if (MessageBox.Show("Do you want the report to be centered on the page", "InvoiceManager - Center on Page", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                MyDataGridViewPrinter = new DataGridViewPrinter(GirdviewPrinting, printDocument1, true, true, "Customers", new Font("Tahoma", 18, FontStyle.Bold, GraphicsUnit.Point), Color.Black, true);
            else
                MyDataGridViewPrinter = new DataGridViewPrinter(GirdviewPrinting, printDocument1, false, true, "Customers", new Font("Tahoma", 18, FontStyle.Bold, GraphicsUnit.Point), Color.Black, true);

            return true;
        }

        protected void SetDefaultColorList(DevComponents.DotNetBar.Controls.ListViewEx lst)
        {
            for (int i = 0; i < lst.Items.Count; i++)
            {
                if (i % 2 == 0)
                {
                    lst.Items[i].BackColor = System.Drawing.Color.FromArgb(192, 255, 192);//.Blue;
                    for (int j = 0; j < lst.Items[i].SubItems.Count; j++)
                    {
                        lst.Items[i].SubItems[j].BackColor = System.Drawing.Color.FromArgb(192, 255, 192);//.Blue;
                    }

                }
                else
                {
                    lst.Items[i].BackColor = System.Drawing.Color.FromArgb(192, 255, 255);//.Yellow;
                    for (int j = 0; j < lst.Items[i].SubItems.Count; j++)
                    {
                        lst.Items[i].SubItems[j].BackColor = System.Drawing.Color.FromArgb(192, 255, 255);//.Yellow;
                    }

                }

            }
        }
    }
}